DeployLX Software Protection System

The License Validation Process

This topic gives a general picture of the license validation process and how DeployLX interacts with your software.

DeployLX Licensing is used to protect the use of your software by enforcing one or more limits on a license. The following subjects are discussed in this topic and cover the basics needed to get started protecting your software.

Requesting a License

Adding licensing support to your assembly and checking for a valid license.

Finding and Validating a License

DeployLX searches the client machine for a valid license. While searching each license is checked for modification, serial numbers and each limit is validated.

Requesting a License

The Project Wizard is used to add licensing support to C# and Visual Basic .NET projects.

After licensing support has been added to an assembly call the Validate method of the SecureLicenseManager to look for a valid license.

Example

This sample demonstrates how to request a valid license from the SecureLicenseManager.

Imports System
Imports System.Windows.Forms
Imports DeployLX.Licensing.v5

Namespace CSharpProtectedDll
    Public Class ProtectedClass
        Private _license As SecureLicense

        Public Sub New()
            _license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
        End Sub

        Public Sub DoSomething()
            If _license.IsTrial Then
                MessageBox.Show("Hello from ProtectedClass, enjoy the trial.")
            Else
                MessageBox.Show("Hello from ProtectedClass, thanks for your purchase.")
            End If
        End Sub
    End Class
End Namespace
using System;
using System.Windows.Forms;
using DeployLX.Licensing.v5;

namespace CSharpProtectedDll
{
    public class ProtectedClass
    {
        private SecureLicense _license;

        public ProtectedClass()
        {
            _license = SecureLicenseManager.Validate( this, null, null );
        }

        public void DoSomething(  )
        {
            if( _license.IsTrial )
                MessageBox.Show( "Hello from ProtectedClass, enjoy the trial." );
            else
                MessageBox.Show( "Hello from ProtectedClass, thanks for your purchase." );
        }        
    }
}

Finding and Validating a License

When the SecureLicenseManager is asked for a license it will search the local machine for a valid license. Licenses are stored on the machine as .LIC files which contain one or more SecureLicense instances.

While searching each license in a license file is validated to determine if the current licensing context meets all the required limits defined in the license. Each license can contain one or more of the 35 built in limits or custom limits that define the rights and rules granted to the user. If any of the requirements imposed by a limit are not met then the license is not considered valid and DeployLX will continue looking.

See the Using Limits to Control the Use of Your Software topic for details on using limits.

The following steps are performed on each license to determine if it is valid.

Signature check

The signature on a license is used to ensure that the license has not been modified and was created using the same keys used to protect the assembly.

Serial number check

If the signature is valid and the license requires a serial number then the serial number for the license is checked to see if it was generated with the same keys used to sign the license. If the serial number is valid or license does not require a serial number (such as a trial license) then validation continues to the next step.

See the Serial Numbers and the Registration Process topic for more details.

Validate method of each limit is called

The first time the license is validated on each process execution or after the license cache has been reset the Validate method of each limit is called.

Limits that display a form to the user will do so at this step. For example the Trial limit will display a form to the user indicating that the license is a trial version and ask if the user accepts the terms of the trial. If the user does not agree then the license is not valid and DeployLX continues searching for a different license.

If any of the limits return ValidationResult.Retry then validation will restart by either re-checking the current license or by validating a newly obtained license file depending on the actions taken by the limit.

Granted method of each limit is called

If all the limits in the license return ValidationResult.Valid from the Validate method then the Granted method will be called for each limit. The Granted method is called every time a license is requested even if the license was loaded from the cache.

Delayed validation is started

If all limits return ValidationResult.Valid from the Granted method any delayed limits that requested asynchronous validation are queued for processing and will perform their validation logic on a new thread.

License is cached

If the license passes all validation checks then it is added to the license cache and will be the first license checked on subsequent calls to SecureLicenseManager.Validate.

Valid license is returned

After the license has been cached a copy of the license will be returned to the caller.

or Validation Fails

If a valid license cannot be found then DeployLX will throw a NoLicenseException which can be caught and processed by the protected software.

See the Handling Errors During Validation topic for details.

See Also